<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .div1 {
            width: 200px;
            height: 200px;
            background-color: red;
        }
        .div2 {
            width: 150px;
            height: 150px;
            background-color: green;
        }
        .div3 {
            width: 100px;
            height: 100px;
            background-color: yellowgreen;
        }
    </style>
</head>
<body>
    <div id="div">
        <p>@click.stop 阻止冒泡</p>
        <div class="div1" @click="showMsg('div1')">
            <div class="div2" @click.stop="showMsg('div2')">
                <div class="div3" @click.stop="showMsg('div3')"></div>
            </div>
        </div>
        <hr>
        <p>@contextmenu.prevent 阻止默认事件</p>
        <div class="div3" @contextmenu.prevent="showMenu"></div>
        <hr>
        <p>@click.self 只能由自己触发，不能由别的元素代为执行</p>
        <p>@click.once 只执行一次，登陆、提交。。</p>
        <div class="div1" @click="showMsg('div1')">
            <div class="div2" @click.self="showMsg('div2')">
                <div class="div3" @click.once="showMsg('div3')"></div>
            </div>
        </div>
        <hr>
        <hr>
        <div class="div1" @click.capture="showMsg('div1')">
            <div class="div2" @click.capture="showMsg('div2')">
                <div class="div3" @click="showMsg('div3')"></div>
            </div>
        </div>
    </div>
    <script src="../vue.js"></script>
    <script>
        let vm = new Vue({
            el: '#div',
            data: {

            },
            methods: {
                showMsg(info) {
                    console.log(info);
                },
                showMenu() {
                    console.log('你右键了');
                }
            }
        })
    </script>
</body>
</html>